package com.sky.business.sys.vo;

import com.sky.business.sys.domain.CameraConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class CameraConfigVo {

    @Schema(description = "id")
    private Long id;

    /**
     * 摄像头设备ID
     */
    @Schema(description = "设备ID")
    private String cameraDeviceId;

    /**
     * 摄像头设备名称
     */
    @Schema(description = "设备名称")
    private String cameraDeviceName;

    /**
     * 摄像头IP地址
     */
    @Schema(description = "设备IP")
    private String cameraIp;

    /**
     * 摄像头端口
     */
    @Schema(description = "设备端口")
    private String cameraPort;

    /**
     * 摄像头rtsp端口
     */
    @Schema(description = "设备rtsp端口")
    private String cameraRtspPort;

    /**
     * ONVIF用户名
     */
    @Schema(description = "onvif用户名")
    private String onvifUser;

    /**
     * ONVIF密码
     */
    @Schema(description = "onvif密码")
    private String onvifPasswd;

    /**
     * 摄像头纬度
     */
    @Schema(description = "设备纬度")
    private String cameraLongitude;

    /**
     * 摄像头经度
     */
    @Schema(description = "设备经度")
    private String cameraLatitude;

    /**
     * 摄像头海拔
     */
    @Schema(description = "设备海拔高度")
    private String cameraAltitude;

    /**
     * 最后一次心跳时间
     */
    @Schema(hidden = true)
    private Date lastHeartBeatTime;

    /**
     * 水平误差角
     */
    @Schema(description = "设备水平误差角")
    private String panAngle;

    /**
     * 垂直误差角
     */
    @Schema(description = "设备垂直误差角")
    private String tiltAngle;

    /**
     * 摄像头最小焦距
     */
    @Schema(description = "摄像机最小焦距")
    private String cameraFocalLenMin;

    /**
     * 摄像机最大焦距
     */
    @Schema(description = "摄像机最大焦距")
    private String cameraFocalLenMax;

    /**
     * 摄像头变焦范围最大值
     */
    @Schema(description = "设备最大焦距")
    private String cameraZoomRangeMax;

    /**
     * 摄像头垂直旋转范围最小值
     */
    @Schema(description = "设备垂直旋转范围最小值")
    private String cameraTiltRangeMin;

    /**
     * 摄像头垂直旋转范围最大值
     */
    @Schema(description = "设备垂直旋转范围最大值")
    private String cameraTiltRangeMax;


    /**
     * 原始流推流地址
     */
    @Schema(description = "设备推流地址")
    private String pushStream;

    /**
     * ai推流地址
     */
    @Schema(description = "ai推流地址")
    private String aiPushStream;

    /**
     * 拉流地址
     */
    @Schema(description = "设备拉流地址")
    private String pullStream;

    /**
     * ai拉流地址
     */
    @Schema(description = "设备AI流拉流地址")
    private String aiPullStream;

    /**
     * 自动变倍（开关）
     */
    @Schema(description = "自动变倍开关", defaultValue = "true")
    private Boolean autoZoom = true;

    /**
     * 像元尺寸
     */
    @Schema(description = "像元尺寸", defaultValue = "2")
    private String pixelSize = "2";

    /**
     * 设备类型，1：海康，2：大华，3：自研 40倍，4：自研88倍
     */
    @Schema(description = "设备类型")
    private String deviceType = "1";


    /**
     * 设备tilt是否相反
     */
    @Schema(description = "垂直方向是否反转")
    private Boolean reverse = false;

    /**
     * 是否智能设备
     */
    @Schema(description = "是否智能设备")
    private Boolean smart;

    /**
     * 是否启动转推
     */
    @Schema(description = "是否开启转推")
    private Boolean pubStreamEnabled = true;

    /**
     * 所在组id
     */
    @Schema(description = "所属组别ID")
    private Integer groupId;

    @Schema(description = "组别名称")
    private String groupName;

    /**
     * 制造商
     */
    @Schema(description = "设备制造商")
    private String manufacturer;

    /**
     * 型号
     */
    @Schema(description = "型号")
    private String model;

    /**
     * 固件版本
     */
    @Schema(description = "固件版本")
    private String firmwareVersion;

    /**
     * 序列号
     */
    @Schema(description = "序列号")
    private String serialNumber;

    /**
     * 最小检测距离
     */
    @Schema(description = "设备最小检测距离（m）")
    private Integer detectMinDist;

    /**
     * 最大检测距离
     */
    @Schema(description = "设备最大检测距离（m）")
    private Integer detectMaxDist;

    /**
     * 1倍的水平视场角
     */
    @Schema(description = "1倍水平视场角")
    private BigDecimal horizontalFov;

    /**
     * 1倍的垂直市场角
     */
    @Schema(description = "1倍垂直视场角")
    private BigDecimal verticalFov;

    /**
     * 是否运行
     */
    @Schema(description = "服务状态")
    private boolean running;

    /**
     * 是否转推
     */
    @Schema(description = "转推状态")
    private boolean pubTaskRunning;

    /**
     * 控制模式
     */
    @Schema(description = "控制模式")
    private Integer controlMode;

    /**
     * ptd模式使用端口
     */
    @Schema(description = "ptd控制模式端口")
    private Integer ptdPort;


    /**
     * 构造器
     * @param cameraConfig 相机配置
     */
    public CameraConfigVo(CameraConfig cameraConfig) {
        this.id = cameraConfig.getId();
        this.cameraDeviceId = cameraConfig.getCameraDeviceId();
        this.cameraDeviceName = cameraConfig.getCameraDeviceName();
        this.cameraIp = cameraConfig.getCameraIp();
        this.cameraPort = cameraConfig.getCameraPort();
        this.cameraRtspPort = cameraConfig.getCameraRtspPort();
        this.onvifUser = cameraConfig.getOnvifUser();
        this.onvifPasswd = cameraConfig.getOnvifPasswd();
        this.cameraLongitude = cameraConfig.getCameraLongitude();
        this.cameraLatitude = cameraConfig.getCameraLatitude();
        this.cameraAltitude = cameraConfig.getCameraAltitude();
        this.lastHeartBeatTime = cameraConfig.getLastHeartBeatTime();
        this.panAngle = cameraConfig.getPanAngle();
        this.tiltAngle = cameraConfig.getTiltAngle();
        this.cameraFocalLenMin = cameraConfig.getCameraFocalLenMin();
        this.cameraFocalLenMax = cameraConfig.getCameraFocalLenMax();
        this.cameraZoomRangeMax = cameraConfig.getCameraZoomRangeMax();
        this.cameraTiltRangeMin = cameraConfig.getCameraTiltRangeMin();
        this.cameraTiltRangeMax = cameraConfig.getCameraTiltRangeMax();
        this.pushStream = cameraConfig.getPushStream();
        this.aiPushStream = cameraConfig.getAiPushStream();
        this.pullStream = cameraConfig.getPullStream();
        this.aiPullStream = cameraConfig.getAiPullStream();
        this.autoZoom = cameraConfig.getAutoZoom();
        this.pixelSize = cameraConfig.getPixelSize();
        this.deviceType = cameraConfig.getDeviceType();
        this.reverse = cameraConfig.getReverse();
        this.smart = cameraConfig.getSmart();
        this.pubStreamEnabled = cameraConfig.getPubStreamEnabled();
        this.groupId = cameraConfig.getGroupId();
        this.manufacturer = cameraConfig.getManufacturer();
        this.model = cameraConfig.getModel();
        this.firmwareVersion = cameraConfig.getFirmwareVersion();
        this.serialNumber = cameraConfig.getSerialNumber();
        this.detectMinDist = cameraConfig.getDetectMinDist();
        this.detectMaxDist = cameraConfig.getDetectMaxDist();
        this.horizontalFov = cameraConfig.getHorizontalFov();
        this.verticalFov = cameraConfig.getVerticalFov();
        this.controlMode = cameraConfig.getControlMode().getValue();
        this.ptdPort = cameraConfig.getPtdPort();
    }

}
